﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Admx_Generator
{
    internal partial class ProjectViewer : UserControl
    {
        internal ProjectViewer(AdmxProject projectToDisplay)
        {
            InitializeComponent();
            this.Project = projectToDisplay;
            this.DisplayProject();
        }

        public AdmxProject Project { get; private set; }

        /// <summary>
        /// Update the UI with informations hosted in the parameter
        /// </summary>
        internal void DisplayProject()
        {
            this.txtBxProjectName.Text = this.Project.ProjectName;
            this.txtBxProjectFolder.Text = this.Project.ProjectFolder;

            if (this.Project.HasAdmx)
            {
                this.txtBxAdmxName.Text = this.Project.Admx.Filename;
                this.txtBxAdmxName.Font = new Font(this.txtBxAdmxName.Font.FontFamily, this.txtBxAdmxName.Font.Size, FontStyle.Regular);               
            }
            else
            {
                this.txtBxAdmxName.Text = "n/a";
                this.txtBxAdmxName.Font = new Font(this.txtBxAdmxName.Font.FontFamily, this.txtBxAdmxName.Font.Size, FontStyle.Italic);
            }
        }
    }
}
